package net.qiqbframework.loadhanding;

import net.qiqbframework.common.Registration;
import net.qiqbframework.lifecycle.Lifecycle;
import net.qiqbframework.messaging.MessageHandler;

import javax.annotation.Nonnull;

/**
 * 聚合加载总线
 */
public interface AggregateLoadBus extends Lifecycle {


    <A> A load(@Nonnull LoadMessage<?> loadMessage);

    <L, R> void load(@Nonnull LoadMessage<L> loadMessage, @Nonnull LoadCallback<L, R> loadCallback);


    Registration subscribe(@Nonnull String aggregateName, @Nonnull String bizIdentifierName, @Nonnull MessageHandler<? super LoadMessage<?>> handler);


}
